/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2001 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.modules.rmi.wizard;
import java.awt.Dimension;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import org.openide.src.*;
/**
*
* @author Ian Formanek
*/
public class MethodPanel extends javax.swing.JPanel {
MethodElement me;
/** Creates new form MethodPanel */
public MethodPanel() {
this(new MethodElement(), true, true);
}
static final long serialVersionUID =688410188246548165L;
/** Creates new form MethodPanel */
public MethodPanel(MethodElement me) {
this(me, true, true);
}
/** Creates new form MethodPanel */
public MethodPanel(MethodElement method, boolean allowMethodNameChange, boolean allowRetValChange) {
initComponents ();
setMethodElement (method);
methodField.setEnabled (allowMethodNameChange);
retField.setEnabled (allowRetValChange);
}
/*
public Dimension getPreferredSize () {
Dimension sup = super.getPreferredSize ();
return new Dimension (Math.max (DEFAULT_WIDTH, sup.width), Math.max (DEFAULT_HEIGHT, sup.height));
}
*/
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the FormEditor.
*/
private void initComponents () {//GEN-BEGIN:initComponents
setLayout (new java.awt.GridBagLayout ());
java.awt.GridBagConstraints gridBagConstraints1;
setPreferredSize (new java.awt.Dimension(440, 120));
methodLabel = new javax.swing.JLabel ();
methodLabel.setText ("Method Name:");
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.insets = new java.awt.Insets (1, 5, 1, 5);
gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
add (methodLabel, gridBagConstraints1);
methodField = new javax.swing.JTextField ();
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.gridwidth = 0;
gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints1.insets = new java.awt.Insets (1, 5, 1, 5);
gridBagConstraints1.weightx = 1.0;
add (methodField, gridBagConstraints1);
parametersLabel = new javax.swing.JLabel ();
parametersLabel.setText ("Parameters:");
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.insets = new java.awt.Insets (1, 5, 1, 5);
gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
add (parametersLabel, gridBagConstraints1);
parametersField = new javax.swing.JTextField ();
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.gridwidth = 0;
gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints1.insets = new java.awt.Insets (1, 5, 1, 5);
gridBagConstraints1.weightx = 1.0;
add (parametersField, gridBagConstraints1);
retLabel = new javax.swing.JLabel ();
retLabel.setText ("Return Type:");
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.insets = new java.awt.Insets (1, 5, 1, 5);
gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
add (retLabel, gridBagConstraints1);
retField = new javax.swing.JTextField ();
gridBagConstraints1 = new java.awt.GridBagConstraints ();
gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints1.insets = new java.awt.Insets (1, 5, 1, 5);
gridBagConstraints1.weightx = 1.0;
add (retField, gridBagConstraints1);
}//GEN-END:initComponents
public MethodElement getMethodElement () throws IllegalArgumentException, SourceException {
return SrcSupport.getRMIMethodElement(me, methodField.getText(), parametersField.getText(), retField.getText());
}
public void setMethodElement (MethodElement me) {
this.me = me;
methodField.setText(me.getName().toString());
parametersField.setText(SrcSupport.getParameters(me.getParameters()));
retField.setText(me.getReturn().toString());
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel methodLabel;
private javax.swing.JTextField methodField;
private javax.swing.JLabel parametersLabel;
private javax.swing.JTextField parametersField;
private javax.swing.JLabel retLabel;
private javax.swing.JTextField retField;
// End of variables declaration//GEN-END:variables
}
/*
* <<Log>>
* 4 Gandalf 1.3 11/27/99 Patrik Knakal
* 3 Gandalf 1.2 10/23/99 Ian Formanek NO SEMANTIC CHANGE - Sun
* Microsystems Copyright in File Comment
* 2 Gandalf 1.1 7/22/99 Martin Ryzl first working version
* 1 Gandalf 1.0 7/20/99 Martin Ryzl
* $
*/